package com.kaigejava.template.hotdrink;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * Created by kaigejava on 2019/9/5.
 */
public class TeaWithHook extends  HotDrinkTemplate {
    @Override
    protected void addCondiments() {
        System.out.println("四.加柠檬");
    }

    @Override
    protected void brew() {
        System.out.println("二.泡茶叶");
    }
    @Override
    protected  boolean wantCondimentsHook(){

        System.out.println("是否添加柠檬? 是，输入Y，不添加，输入N：");
        BufferedReader strin = new BufferedReader(new InputStreamReader(
                System.in));
        String result = "";
        try {
            result = strin.readLine();
        }catch (Exception e){
            e.printStackTrace();
        }
        if("Y".equals(result)){
            System.out.println("添加柠檬的");
            return true;
        }
        System.out.println("我的，不加柠檬");
        return false;
    }
}
